Giter Site home page Giter Site logo

Comments (22)

ChristopheJacquet avatar ChristopheJacquet commented on August 17, 2024

I did not notice a difference with the Raspberry Pi 2. Having to tinker with ppm to fix audio defects doesn't sound right either. Is RDS working?

from pifmrds.

junhawng avatar junhawng commented on August 17, 2024

Hi, thank you for the reply, would there be a specific way to test the RDS? The reason I changed the ppm was because it was playing very slowly which also naturally brought down the pitch of the song. So I increased it to about 75000.

from pifmrds.

itchytweed avatar itchytweed commented on August 17, 2024

Poor audio quality - low audio pitch on RPi2. Base Raspbian clock speed is 700 MHz. Was not getting a stereo beacon or RDS data through. I fixed my version of this issue by going into raspi-config and raising the clock speed to 900 MHz. Getting Stereo beacon and RDS data now as well. BTW, I am running no ppm correction.

Another issue that I have not been able to resolve by snooping in the code referencing poor audio quality is I do not see any transmission pre-emphasis of the audio, listed either at 75 us or 50 us. A FM receiver has a deemphasis circuit in it so a flat signal will sound muddy and a lack of highs to it. I fixed my version of this by using SOX and treble boost before piping it to PiFmRds.

from pifmrds.

sbruder avatar sbruder commented on August 17, 2024

On my Raspberry Pi 2 I have bad sound quality, but I also have it on my Raspberry Pi B. The Quality on the Raspberry Pi B is better than on the 2, but not good.

from pifmrds.

itchytweed avatar itchytweed commented on August 17, 2024

Here is the command line that I have been using and getting some high quality FM out of this:

sox --norm [file].wav -c 2 -t wav - firfit ./75usPreEmphasis.ff | sudo ./pi_fm_rds -freq 88.5 -audio -

I am using the 'firfit' option within sox to add the necessary preemphasis for the United States so the audio does not sound so muddy using an FM receiver. The file '75usPreEmphasis.ff' contains the following:

20 0.000
100 0.010
200 0.038
300 0.085
400 0.150
500 0.233
600 0.331
700 0.445
800 0.572
900 0.712
1000 0.864
2000 2.742
3000 4.742
4000 6.551
5000 8.129
6000 9.504
7000 10.711
8000 11.784
9000 12.746
10000 13.617
11000 14.412
12000 15.143
13000 15.818
14000 16.446
15000 17.033
16000 17.583
17000 18.101
18000 18.590
19000 19.054
20000 19.494
21000 19.913
22000 20.313
23000 20.696
24000 21.063

First column is the frequency in Hz and the second column is dB boost to be applied. I extended this out to 24,000 Hz as that is half of the 48000 Hz sampling frequency and will also cover 44,100 Hz sampling as well.

Followup: Using 'raspi-config', I selected the 'Pi2' option and that sure helped out on the preprocessing time.

from pifmrds.

 avatar commented on August 17, 2024

@itchytweed Thanks, it sounds little bit better to me.

from pifmrds.

ChristopheJacquet avatar ChristopheJacquet commented on August 17, 2024

@itchytweed You're right, there's no pre-emphasis. It's tracked by bug #52 now.

A note on "sound quality": don't forget that the program is modulating a square wave as a carrier. Transmitting FM using the RaspberryPi clock in the first place was a feat (cheers to the icrobotics folks!), PiFmRds adds RDS which was kind of a feat too, but don't expect too much on the audio side :) If you want good audio quality, use a proper FM transmitter, not a hack...

from pifmrds.

 avatar commented on August 17, 2024

@ChristopheJacquet After using the sox 'firfit' option together with the file which posted @itchytweed the sound quality is actualy pretty good. I belive It can be used as home broadcasting to other room like things.

from pifmrds.

allegfede avatar allegfede commented on August 17, 2024

i suppose there is an error in the sox/pifm command.
I tested those two with success:
sox --norm -t mp3 /home/pi/Music/presentazione_Orvieto_lug_RDS_hack.mp3 -c 2 -t wav - firfit /home/pi/src/PiFmRds/75usPreEmphasis.ff | sudo /home/pi/src/PiFmRds/src/pi_fm_rds -pi 1234 -rt 'ciao agli studenti orvietani' -ps ORV-LUG -freq 88.5 -audio -

and with live audio from cheap usb sound card:
sox -t alsa hw:1,0 -c 2 -t wav - firfit /home/pi/src/PiFmRds/75usPreEmphasis.ff | sudo /home/pi/src/PiFmRds/src/pi_fm_rds -pi 1234 -rt 'ciao agli studenti orvietani' -ps ORV-LUG -freq 88.5 -audio -

Happy hacking :D

from pifmrds.

kwilium avatar kwilium commented on August 17, 2024

Hi there,

I got my best option with the following command:
sox -t mp3 http://STREAMURL.m3u -t wav -c 2 - firfit ./75usPreEmphasis.ff | sudo ./PiFmRds/src/pi_fm_rds -freq FREQ-NUMBER -audio -

Thanks for your help and enjoy

from pifmrds.

miegl avatar miegl commented on August 17, 2024

One thing that could improve the quality of sound but no one mentions it - the FM deviation. The default value of 25 is ok, but sounds pretty bad & static to me. However after switching to the half, 12.5, the sound quality improved a lot. Sure, its more quiet, but as I said, the sound quality is just better.

The deviation is defined here.

Simply change it to something like this:
#define DEVIATION 12.5

from pifmrds.

pilovis avatar pilovis commented on August 17, 2024

This is my "75usPreEmphasis.ff" file:

20 0.000
100 0.010
200 0.038
300 0.185
400 0.450
500 0.533
600 0.731
700 1.445
800 2.072
900 2.712
1000 2.864
2000 3.042
3000 4.742
4000 6.551
5000 8.129
6000 9.504
7000 10.711
8000 11.784
9000 12.746
10000 13.617
11000 12.412
12000 11.143
13000 10.000
14000 10.446
15000 10.033
16000 10.583
17000 10.101
18000 9.590
19000 8.054
20000 7.494
21000 6.913
22000 5.313
23000 4.696
24000 3.063

I reduced gain at high frequencies because of too much noise.

Also this is my command line to rebroadcast an internet radio:

sox -t mp3 http://205.164.62.15:9010/ -t wav -c 2 - firfit ./75usPreEmphasis.ff | sudo ./PiFmRds/src/pi_fm_rds -rt 'Rochenroll Ciulers' -ps RADIO-88 -freq 88.0 -audio -

Use P2i overclock to get better performances (1000 Mhz).

from pifmrds.

pilovis avatar pilovis commented on August 17, 2024

If you want to use sox to play mp3 files or streaming internet radio (mp3), you need to install the following packages:

sudo apt-get install sox
sudo apt-get install lame
sudo apt-get install libsox-fmt-mp3

from pifmrds.

itchytweed avatar itchytweed commented on August 17, 2024

from pifmrds.

pilovis avatar pilovis commented on August 17, 2024

you're right, but I had to cut the treble because of too much noise at high frequencies.

from pifmrds.

pilovis avatar pilovis commented on August 17, 2024

this is my 75usPreEmphasis.ff file , not a real 75 or 50uS emphasis, but it gives the best audio output, at least here in Europe:

20 0.000
50 0.001
100 0.004
500 0.096
600 0.138
700 0.186
800 0.241
900 0.303
1000 0.370
2000 1.290
3000 2.430
4000 3.540
5000 4.530
6000 5.380
7000 6.100
8000 6.690
9000 7.190
10000 7.610
11000 7.950
12000 8.250
13000 8.490
14000 8.710
15000 8.890
16000 9.050
17000 9.180
18000 9.300
19000 9.400
20000 9.490
21000 10.000
22000 10.313
23000 10.696
24000 11.063

from pifmrds.

pilovis avatar pilovis commented on August 17, 2024

Miegl,

reducing the deviation from 25 to 12.5 means that you are cutting to the half the audio bandwidth.

from pifmrds.

pilovis avatar pilovis commented on August 17, 2024

If you wanto to calclulate the correct values for 50 Eu pre-emphas, use the following chart:

http://www.radiomuseum.org/forumdata/users/133/Pre_Empf_Bode_590.png

from pifmrds.

miegl avatar miegl commented on August 17, 2024

@pilovis I know. 12.5 just sounds little bit better with current PiFmRds.

from pifmrds.

miegl avatar miegl commented on August 17, 2024

I suggest trying this pull request - #17
But keep in mind that its way better to use deviation like 75 (I wouldn't go bellow 50) with this pull request.

from pifmrds.

pilovis avatar pilovis commented on August 17, 2024

precise amplitude responses for 50uS (European) pre-emphasis

Frequence dB
20 0.000
50 0.001
100 0.004
400 0.068
1000 0.409
2000 1.445
3000 2.761
4000 4.115
5000 5.400
6000 6.583
7000 7.661
8000 8.643
9000 9.540
10000 10.362
11000 11.120
12000 11.882
13000 12.475
14000 13.084
15000 13.656

from pifmrds.

pilovis avatar pilovis commented on August 17, 2024

Sox firfit is experimental, I read that the maximum knot shoud not go over 15 Khz, because it is not accurate above this frequence and may cause problems.
Also, FM modulation is designed to handle Audio from 20Hz to 15 KHz.

from pifmrds.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.