TooTallNate / node-lame

Node.js native bindings to libmp3lame & libmpg123
MIT License
567 stars 113 forks source link

Encoding with 1 channel causes segmentation fault, encoding with 2 channels gets fast mp3 #81

Closed Keyne closed 5 years ago

Keyne commented 6 years ago

I'm just testing this project (https://github.com/noamtcohen/AudioStreamer) on a ubuntu 16 box and I'm getting segmentation fault when lame tries to encode the PCM data with 1 channel. If I change to 2 channels I get a fast mp3 (timing) instead of the actual audio.

The project owner said that this doesn't happens in his machine. Any clue? Related issue https://github.com/noamtcohen/AudioStreamer/issues/14

murat-mehmet commented 5 years ago

For reference, I could encode with 2 channels by dividing sampleRate by 2:

                    encoder = new lame.Encoder({
                        // input
                        channels: 2,        // 2 channels (left and right)
                        bitDepth: 16,       // 16-bit samples
                        sampleRate: sampleRate/2,  // 44,100 Hz sample rate

                        // output
                        bitRate: 128,
                        outSampleRate: 22050,
                        mode: lame.STEREO
                    });