#lang racket/base (require "../main.rkt" "../audio-encoder.rkt") (define (convert-to-opus flac-in opus-out) (let* ((opus-kbps 224) (settings (hash 'bitrate (* opus-kbps 1000) 'vbr #t)) ) (with-handlers ([exn? (λ (e) (displayln (format "~a" e)) (when (file-exists? opus-out) (delete-file opus-out)) #f)]) (let ((result (audio-encode flac-in opus-out settings #:encoder 'opus #:copy-tags? #t))) #t) ) ) ) (define (times-3-convert flac-in opus-out1 opus-out2 opus-out3 #:pool [pool #f]) (define (start opus-out) (thread (λ () (displayln (format "Starting conversion: ~a" opus-out)) (convert-to-opus flac-in opus-out) (displayln (format" converted: ~a" opus-out)) #t ) #:pool pool) ) (let* ((t1 (start opus-out1)) (t2 (start opus-out2)) (t3 (start opus-out3)) ) (thread-wait t1) (thread-wait t2) (thread-wait t3) ) ) ; (convert-to-opus "\\\\panderleou\\music\\Jazz\\LA4\\LA4 - Zaca\\01 Zaca.flac" "c:\\tmp\\test.opus" )