grahamwhaley / dspham Goto Github PK
View Code? Open in Web Editor NEWA Teensy based DSP audio processor
License: GNU General Public License v3.0
A Teensy based DSP audio processor
License: GNU General Public License v3.0
We could do with some documentation on the menu system, including:
I noticed that slot saving was not taking effect after a reboot.
It turns out that if you have changed firmware versions, as we have a version dependant fingerprint in the eeprom settings, the firmware will 'default' due to an eeprom version mismatch, and load the default settings on boot - thus, skipping loading any setting changes that are stored in the eeprom.
So, the settings you edit do afaict get saved in the eeprom, they just won't get reloaded if there is an eeprom version mismatch.
The quick workaround/fix is to do a settings factory reset, which should rewrite the defaults of the current firmware into the eeprom (including the fingerprint), and then you should be able to save/load again.
If we were to make this 'really nice', we'd probably notice the eeprom version did not match the firmware, and in the settings menu 'persuade' the user they need to do a factory reset of the settings. We probably should not auot-reset the eeprom - take the 'path of least surprise' for the user.
Whilst perusing the forks of DSPham (something I do now and then), I spotted that @robaol had added support for a different I2C LCD in their repo (nice!). I'd happily consider adding this code if a suitable pull request were submitted @robaol :-)
For reference, the patch adds support using the same ArduinoMenu system, supporting the I2C LCD code from mathertel.
Hi Graham, i am not good with modifying the codes, need the thing modified to display in 1602 I2C, i cannot do it. Please help.
Graham,
I built up an Audio board with a Teensy 4.0 and hooked it up according to your schematic. I loaded the libraries and then compiled and uploaded the program. I am getting audio through the board and the encoder seems to be working (I can turn off the audio with a particular sequence of encoder manipulations), but I am not seeing any text on the display. The backlight is on. I am using the exact Grove RGB LCD specified in the documentation. I have the VCC for the display connected to the 3.3V output of the Teensy, GND connected to ground, and SDA and SCL connected according to the schematic. I have checked my wiring multiple times. The display I have says that it supports an input voltage of 3.3V or 5V. I thought maybe there was a problem with my compiled version of the firmware so I downloaded your .hex file and loaded it. I got the same results.
I could have a bad display, but I want to ask if you have any thoughts on what the problem might be.
Thanks,
Scott
It looks like I 'missed' an NR algo in my original research. I added the xanr
algo from WDSP, but completely missed that it also contains a spectral NR algo, generally called NR2 (as that is how it is labelled in the relevant GUIs), but can be found in the file emnr.c in the library itself.
It could be quite a challenge to integrate, as:
Hello Graham,
some time ago we have talk about a voice squelch, and now i see some code about it,
but i don´t know how to make it work with DSPham.
From Warren, NR0V:
Link to the source files:
https://www.dropbox.com/s/u7wd1of0opm6pct/2023-03-30%20WIP%20-%20ssql.zip?dl=0
There is also one link for the code, if you have some time check it please.
Regards
.
Whilst working on some other experimentation, I noticed that the auto-generated FIR filter co-efficients for the bandpass filters seem to introduce a lot of attenuation, and are probably not 'optimal' for the required operation. That is no real surprise, as they are generated by a quick dynamic piece of code, and calculating optimal FIR coefficients is compute intensive.
The FIR filters happen early in the chain, which means later stages are probably not getting as 'full' a bitwidth signal as they should. This probably affects their performance.
I have some experimental code already that tries to measure the gain of the coefficients at their 'centre peak' intended frequency. Let's see if that improves anything.
(If you want to look at this etc., probably best ask me first so we don't duplicate)
I am trying to get the audio incoming into the DSP to be routed in the "in/mic" of the USB, but I think I am missing something.
I have tried adding:
AudioOutputUSB usb2;
...
AudioConnection patchCord15(usb1, 0, usb2, 0);
AudioConnection patchCord16(usb1, 0, usb2, 1);
Also with Q_in_L
or peak_amp
instead of usb1
but nothing.
What can I be missing here ?
There seem to be at least a couple of things wrong with the 'save settings'.
I was trying to 'clone' an existing slot and change the active NR. I selected CW (slot 5), set the slot number in the settings menu and set the name, and changed the NR algo from none to LLMS. Then I saved into slot7. When then re-selecting slot7, the name was blank and the NR was not set...
Looking at the code, it seems that saveSettings()
does not save the name, which looks to be a bug. Should be an easy fix?
I've not worked out why the NR did not get set - that might require some actual debug...
It feels like if a decoder (CW) is active and decoder whilst you are in the 'edit slot name' text editing menu, things get a bit weird on the screen, as the cursor jumps around to the top line, when it should be on the edit text.
I suspect one of two things:
setCursor
, even though the decode 'display' is off, as we are in the menuI suspect (1), but the code
looks good on a cursory glance:
if (display ) {
lcd.setCursor(0, 0);
lcd.print(buf);
}
Hello Graham, is it possible to increase the slots to 20 ?
How about a squelch/gate to make noise floor complete silent and only voice open the audio ?
Just ideas to make it better.
Tanks for your amazing project.
We cover the display layout in the README, but we don't explain what the values of each entry mean. It would help users if we documented this better. Here is a very quick rundown for starters:
When not in CW mode, the top line displays the current active settings slot (00-10), and the name of the slot (SSB
etc, or Empty
if the slot contains no settings.
When in CW mode, the decoded CW scrolls across the top line, from right to left.
The status line is always displayed, and the each status item/position has a fixed function. They are, in order from left to right:
Shows 'bars' indicating the input signal volume level. A single '.' is the lowest level. Four 'bars' is a high level. If input clipping (volume too high) is detected then an !
will appear for 0.5s.
Indicates which bandpass filter is active. Values are:
->
passthru (not actually off, but 'broadbanded')S
SSBC
CWA
AMF
FMShows if the noise blanker is on or off. Shows -
for off, and an 'impulse' type character (similar to ~
or a slanted N
) when active.
Shows if the noise blaner is enabled or not. Shows -
when it is off, and a stylised V
when it is on.
Shows which, if any, AGC (like) method is in use. Values are:
-
Off (no AGC)T
software 'tracking' mode (tries to match the peak output volume with the peak input volume)5
SGTL5000 hardware AGC mode (the AGC in the audio codec hardware chip). Is not an AGC as you might think of it - there is not minimum level squelch type clip. Fundamentally it will try to maintain an even maximum volume without clipping.Shows which noise reduction algorithm is active. Values are:
BYP
complete bypass mode (may not be possible to configure currently)Off
noise reduction is turned offLMS
LMS reduction modeKim
Kim reduction modefnr
fnr reduction modefnA
fnrA reduction modeSpc
Spectral reduction modeLLM
LLMS reduction modeShows a rough estimate of the amount of CPU time that is being consumed doing the processing. Generally a fairly low number.
A rough guide to help tune in the CW decoder. The CW decoder 'listens' to the centre frequency defined for the active bandpass filter. The tuning aid listens for the 'loudest' tone in the signal, and shows one of five symbols to reflect how the detected tone relates to the bandpass:
<<
Tone much too low<
Tone too lowx
Tone matched>
Tone too high>>
Tone much too highShows the current detected CW word per minute speed as detected by the decoder that is active. Note, if using the Bayesian decoder there can be some delay between signals being heard and the WPM and decoded characters being printed.
The k4icy CW decoder has some of the decode characters commented out in the code, such as here:
//if (strcmp(elementSequence,"-...-") == 0) { decodeChar = 61; } // = (Pause, BT)
Now my CW 'ear' is getting better, I've started to notice these :-). It's not clear why they are commented out - it looks to be that way in the original code as well.
=
was the one I noticed 'live', and the above code visually looks right to me - there is an =
in the 2x16 LCD character set, and it is 61 (0xd3).
First step then, uncomment the =
line above, and see if we get a correct decode for -...-
If that works, move on to see what else is commented out and if there is a sensible way to instate those on the 2x16 charset.
My gut was telling me maybe there was a disparity between the 2x16 charset and ascii, but looking at an ascii chart, =
is indeed 61 - so maybe that theory does not wash...
Some of the NR reduction algos, such as the Spectral (possibly the best one), work on 'bins', splitting the audio into 'bins' and then selecting which ones have audio in them or not etc.
Currently (v1.0) we run the audio path at a full 44kHz sample rate, which is 'wasteful', as we are normally only interested in the audio part, which is probably upto 3.5kHz max.
If we decimate the audio path by 4, that takes us down to ~11kHz, so an audio bandwidth of ~5.5kHz. That will still leave us with plenty of 'space' for normal audio, and even an OK bandwidth for AM SWL. It will hopefully allow the NR systems to 'focus' more finely on the actual audio, and thus hopefully do an even better job of sorting out the noise from the useful sounds.
Try it out...
Hello Graham,
Very interested in your Radcom article as I have been trying to improve the audio on my IC7300 to get rid of some of noise on the output. I am not a programmer so could do with a bit of help if that is possible.
I am trying to compile DSPham.ino but it fails every time. I believe I have all the necessary files within my arduino IDE but it always comes back with an error as below where it cannot find global.h
Any help would be much appreciated.
Rod G0IYQ
Arduino: 1.8.13 (Windows 10), TD: 1.53, Board: "Teensy 4.0, Serial, 600 MHz, Faster, US English"
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\rodmi\Documents\Arduino\libraries -fqbn=teensy:avr:teensy40:usb=serial,speed=600,opt=o2std,keys=en-us -ide-version=10813 -build-path C:\Users\rodmi\AppData\Local\Temp\arduino_build_958171 -warnings=none -build-cache C:\Users\rodmi\AppData\Local\Temp\arduino_cache_775077 -verbose C:\Users\rodmi\AppData\Local\Temp\untitled2054921278.tmp\sketch_feb18a\sketch_feb18a.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\rodmi\Documents\Arduino\libraries -fqbn=teensy:avr:teensy40:usb=serial,speed=600,opt=o2std,keys=en-us -ide-version=10813 -build-path C:\Users\rodmi\AppData\Local\Temp\arduino_build_958171 -warnings=none -build-cache C:\Users\rodmi\AppData\Local\Temp\arduino_cache_775077 -verbose C:\Users\rodmi\AppData\Local\Temp\untitled2054921278.tmp\sketch_feb18a\sketch_feb18a.ino
Using board 'teensy40' from platform in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr
Using core 'teensy4' from platform in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr
Detecting libraries used...
"C:\Program Files (x86)\Arduino\hardware\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=153 -DARDUINO=10813 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4" "C:\Users\rodmi\AppData\Local\Temp\arduino_build_958171\sketch\sketch_feb18a.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for Audio.h: [[email protected]]
ResolveLibrary(Audio.h)
-> candidates: [[email protected]]
"C:\Program Files (x86)\Arduino\hardware\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=153 -DARDUINO=10813 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Audio" "C:\Users\rodmi\AppData\Local\Temp\arduino_build_958171\sketch\sketch_feb18a.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for SPI.h: [[email protected]]
ResolveLibrary(SPI.h)
-> candidates: [[email protected]]
"C:\Program Files (x86)\Arduino\hardware\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=153 -DARDUINO=10813 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Audio" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI" "C:\Users\rodmi\AppData\Local\Temp\arduino_build_958171\sketch\sketch_feb18a.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for SD.h: [[email protected] [email protected]]
ResolveLibrary(SD.h)
-> candidates: [[email protected] [email protected]]
"C:\Program Files (x86)\Arduino\hardware\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=153 -DARDUINO=10813 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Audio" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD" "C:\Users\rodmi\AppData\Local\Temp\arduino_build_958171\sketch\sketch_feb18a.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for SerialFlash.h: [[email protected]]
ResolveLibrary(SerialFlash.h)
-> candidates: [[email protected]]
"C:\Program Files (x86)\Arduino\hardware\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=153 -DARDUINO=10813 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Audio" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SerialFlash" "C:\Users\rodmi\AppData\Local\Temp\arduino_build_958171\sketch\sketch_feb18a.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for Wire.h: [[email protected]]
ResolveLibrary(Wire.h)
-> candidates: [[email protected]]
"C:\Program Files (x86)\Arduino\hardware\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=153 -DARDUINO=10813 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Audio" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SerialFlash" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire" "C:\Users\rodmi\AppData\Local\Temp\arduino_build_958171\sketch\sketch_feb18a.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for Encoder.h: [[email protected]]
ResolveLibrary(Encoder.h)
-> candidates: [[email protected]]
"C:\Program Files (x86)\Arduino\hardware\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=153 -DARDUINO=10813 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Audio" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SerialFlash" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire" "-IC:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Encoder" "C:\Users\rodmi\AppData\Local\Temp\arduino_build_958171\sketch\sketch_feb18a.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Alternatives for global.h: []
ResolveLibrary(global.h)C:\Users\rodmi\AppData\Local\Temp\untitled2054921278.tmp\sketch_feb18a\DSPham.ino:7:20: fatal error: global.h: No such file or directory
-> candidates: []
compilation terminated.
Multiple libraries were found for "SD.h"
Used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD
Not used: C:\Program Files (x86)\Arduino\libraries\SD
Using library Audio at version 1.3 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Audio
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI
Using library SD at version 1.2.2 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD
Using library SerialFlash at version 0.5 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SerialFlash
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire
Using library Encoder at version 1.4.1 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Encoder
Error compiling for board Teensy 4.0.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.