Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: LAME MP3/Darkice high sample rates. (Read 3933 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

LAME MP3/Darkice high sample rates.

I'm trying to use Darkice with a 96K digital audio input (SPDIF) and am running into problems.

The digital audio source is 96K coming into a Raspberry PI with a Cirrus/Wolfson card with SPDIF. 

When I set my darkice conf file for 96Khz sample rate, I get an error in LameLibEncoder:

Using config file: /etc/darkice.cfg
17-Sep-2017 00:03:05 Using ALSA DSP input device: hw:0,0
17-Sep-2017 00:03:05 buffer size:  1920000
17-Sep-2017 00:03:05 encoding
17-Sep-2017 00:03:05 scheduler high priority 99
17-Sep-2017 00:03:05 Using POSIX real-time scheduling, priority 4
17-Sep-2017 00:03:05 HTTP/1.0 200
17-Sep-2017 00:03:05 set lame mode 1
17-Sep-2017 00:03:05 set lame channels 2
17-Sep-2017 00:03:05 set lame in sample rate 96000
17-Sep-2017 00:03:05 set lame out sample rate 96000
17-Sep-2017 00:03:05 set lame bit rate 192
17-Sep-2017 00:03:05 set lame quality 0
17-Sep-2017 00:03:05 set lame lowpass frequency 0
17-Sep-2017 00:03:05 set lame highpass frequency 0
17-Sep-2017 00:03:05 set lame psycho acoustic model 1
17-Sep-2017 00:03:05 set lame error protection 1
DarkIce: LameLibEncoder.cpp:261: lame lib initializing params error [0]

I can set darkice to 48Khz sample rate and it launches/runs fine, but then everything comes out like chipmunks.

I've tried some various ALSA asound.conf configurations to try to resample on input from 96k to 48 and use this virtual ALSA device as an input to darkice, but I'm failing there to.

Do I just need to recompile the LAME library with high sample rate support?  Does darkice need to be adjusted to tell LAME to SRC down?

I'm at a loss.

Re: LAME MP3/Darkice high sample rates.

Reply #1
MP3 doesn't support 96khz, so you either need to use a format that supports 96khz, use a sample rate supported by MP3, or configure your system to resample the audio to a supported sample rate.  Most likely you want to configure your source to use 48k (or 44.1k) if possible. 

Re: LAME MP3/Darkice high sample rates.

Reply #2
Unfortunately I'm stuck with a 96Khz source, so I need to work with that somehow.  I'm open to suggestions on the encoded format, but I need it to be functional across a wide variety of platforms from Windows/MacOS/Linux to Android/iOS phones and tablets.

If there's another format that will handle the 96K input and stream to users without them having to download/install extra CODECs on their platform, then I'm game.  I thought only MP3 had that level of universal support.

I attempted a couple of ALSA Asound tricks...But those don't seem to work.

pcm.rate_convert {
    type plug
    slave {
        pcm "hw:0,0"
        rate 48000
    }
}

pcm.in_rate_conv {
        type dsnoop
        ipc_key 123
        slave {
                pcm "hw:0,0"
                channels 2
                rate 48000
        }
}

Neither of those worked.  I still ended up with chipmunks.  To make sure I wasn't heading down the wrong path, I put a 48Khz input in and got normal MP3 encoding.  So I dunno.

If I had to distill my requirements it would be as follows:

Digital input at 96Khz Sample Rate outputting to a universal audio format to be streamed by an Icecast server.

The Darkice/Icecast combo works fine, I just need to resolve the SRC issue on input.  Audio quality is important, but not insanely critical.

Re: LAME MP3/Darkice high sample rates.

Reply #3
Code: [Select]
set lame out sample rate 96000
you have to change the ouput sample rate to one of the possible mpeg rates: 32, 44.1 or 48 kHz

 

Re: LAME MP3/Darkice high sample rates.

Reply #4
I never noticed that there was an optional setting in the Icecast portion of the darkice config file to specify the output sample rate.

Same syntax as the input seciton:

[input]
device        = hw:0,0           # Alsa soundcard device for the audio input
sampleRate    = 96000            # sample rate in Hz. try 11025, 22050 or 44100
bitsPerSample = 16               # bits per sample. try 16
channel       = 2                # channels. 1 = mono, 2 = stereo

[icecast2-0]
bitrateMode   = cbr              # variable bit rate
bitrate       = 192
sampleRate    = 48000
format        = mp3              # format of the stream: mp3


Brilliant!!!

Thanks for the assistance!!