Bug 1176 (allow48000) - Allow 48000Hz
Summary: Allow 48000Hz
Status: ASSIGNED
Alias: allow48000
Product: BpmDj - old linux tools
Classification: Unclassified
Component: sound drivers (show other bugs)
Version: 4.1
Hardware: PC Linux
: Future minor
Assignee: Werner Van Belle
URL:
Depends on:
Blocks:
 
Reported: 2010-03-29 14:00 CEST by Stefan Wanja
Modified: 2010-03-30 14:38 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Comment 7 Werner Van Belle 2010-03-30 14:38:03 CEST
Good, this is a lot more complicated than I first thought. I'm currently reowkring the source to deal with this, but it might only be working by wednesday. The problem is that we have actually three different period.
- the period expressed at the samplerate of the wave file on disk
- the period expressed at the playingrate of the soundcard
- the period expressed at 44100, as stored in the index files.

The various convertions between those different types are somewhat delicate and require some testing before it will work properly.
Comment 6 Werner Van Belle 2010-03-30 13:19:18 CEST
Yes, this is because the index files measure the tempo expressed at a samplerate of 44100 Hz, so if you play it then at 48000Hz you get some problems. The best manner to solve this is leave the index files at 44100 Hz and convert it when the index file is loaded, which is tricky, since at certain places we use the current period to dump it back to an index file. I need to think a bit about this. I'll keep you posted.
Comment 5 Stefan Wanja 2010-03-30 13:08:22 CEST
Ok, it solved the Jack issue with starting, but now everything is playing too fast (new speed = correct speed x 48000/44100)... :)
Comment 4 Werner Van Belle 2010-03-30 11:30:40 CEST
I might. There are some places where the wavrate is still 44100 and where it should remain like that. Especially when writing data to the index files, so that these can be exchanged between different versions of bpmdj.

Your fix is all that is necessary for the jack stuff. The other ones I should read carefully myself, so I leave this bug open.
Comment 3 Stefan Wanja 2010-03-30 10:53:53 CEST
I had a look into the code and there are several places, where 44100 is used as a fixed constant where I think WAVRATE should be in order to adept to changes in player-core.h.

The containing files are:
ao-som-beatgraph.cpp
bpm-analyzer.cpp
bpmclock.cpp
bpmcount.cpp
bpm.cpp
dsp-jack.cpp
fragment-creator.cpp
player-core.cpp
player.cpp
rhythm-analyzer.cpp
wavelet-analyzer.cpp
scripts.h
type-operations.h

When fixing dsp-jack.cpp line 242 to WAVRATE it works.
Will you have a look at all the files and change what needs to be changes?

Regards,
Stefan
Comment 2 Stefan Wanja 2010-03-30 10:46:59 CEST
Hi Werner,

I built a new version with the modified player-core.h as you said (no errors, just some warnings), but it doesn't seem to have an effect on the jack part.
When setting up bpmplay it still complains with the same error 
'engine sample rate: 48000
Please be sure jackd is running at 44100'
When I configure Jack to run at 44100 with my internal sound card bpmplay does not complain, so it still seems to use 44100Hz...
Comment 1 Werner Van Belle 2010-03-29 20:12:35 CEST
Hello, normally this shouldn't be a problme. You can modify the WAVRATE variable in player-core.h, which should then automatically affect all relevant sources as well. Can you try this and verify it ? If there are unexpected errors it shouldn't be hard for me to help you fix them.
Description Stefan Wanja 2010-03-29 14:00:15 CEST
Hello,

why can't I use 48000Hz sampling rates in bpmdj? I would like to use Jack with my USB Soundcard which can only do 48000Hz (as most cheap USB cards I assume). When using Jack I can't (and shouldn't want to) use the USB device via plughw to get the 44100Hz bpmdj desires.
I would like to see support for the common 48kHz sampling rate.

Keep up the great work!
Stefan