Hi I recently bought myself a raspberry pi and decided to try and do the ultrasonic Theremin project. I followed it all correctly but no sound is being produced and I have no idea whether it is working or not.
The project I followed below:
https://projects.raspberrypi.org/en/pro ... c-theremin
-
- Posts: 15890
- Joined: Fri Mar 09, 2012 7:36 pm
- Location: Vallejo, CA (US)
Re: Ultrasonic Theremin Problems
I think the root of your problem is in the word "ultrasonic". Why you expect to be able to hear it?
-
- Posts: 15890
- Joined: Fri Mar 09, 2012 7:36 pm
- Location: Vallejo, CA (US)
Re: Ultrasonic Theremin Problems
W. H. Heydt wrote: ↑Sat Mar 03, 2018 6:35 pmI think the root of your problem is in the word "ultrasonic". Why do you expect to be able to hear it?
Re: Ultrasonic Theremin Problems
Because it produces normal sound frequencies. The ultrasonic part is the sensors that detect hand movement instead of using antenna.W. H. Heydt wrote: ↑Sat Mar 03, 2018 6:35 pmI think the root of your problem is in the word "ultrasonic". Why you expect to be able to hear it?
Re: Ultrasonic Theremin Problems
Rpdom is correct, the sensor is simply ultrasonic the ultrasonic part, the speaker itself will produce normal sounds.
Re: Ultrasonic Theremin Problems
Also I think I will build one of those someday. I already have the ultrasonic sensors 

-
- Posts: 628
- Joined: Wed Jan 03, 2018 5:43 pm
Re: Ultrasonic Theremin Problems
When you did this part:Kraggy123 wrote: ↑Sat Mar 03, 2018 5:37 pmHi I recently bought myself a raspberry pi and decided to try and do the ultrasonic Theremin project. I followed it all correctly but no sound is being produced and I have no idea whether it is working or not.
The project I followed below:
https://projects.raspberrypi.org/en/pro ... c-theremin
Code: Select all
while True:
print(sensor.distance)
sleep(1)
Idaho, U.S.A.
Re: Ultrasonic Theremin Problems
No I never got a print out of the distance
-
- Posts: 628
- Joined: Wed Jan 03, 2018 5:43 pm
Re: Ultrasonic Theremin Problems
Stands to reason why no sound.
What is the error message you are getting?
Idaho, U.S.A.
Re: Ultrasonic Theremin Problems
At the moment I get no error message. It seems to run fine and there is no hint that it's gone wrong somewhere, except with no distances being printed and no sound being played.
-
- Posts: 628
- Joined: Wed Jan 03, 2018 5:43 pm
Re: Ultrasonic Theremin Problems
This code:
Code: Select all
while True:
print(sensor.distance)
sleep(1)
Change to:
Code: Select all
while True:
print(sensor.distance)
print ("did the thing")
sleep(1)
Idaho, U.S.A.
Re: Ultrasonic Theremin Problems
AFAIK there is a problem with the ultrasonic sensor interface in gpiozero - Basically the sensor won't detect any distance so any project based on distance will not work. I had to develop my own ultrasonic class using Pigpio to make the theremin and other projects work.
Re: Ultrasonic Theremin Problems
I changed the code to the "did that thing" and It didn't print it or anything else.
-
- Posts: 628
- Joined: Wed Jan 03, 2018 5:43 pm
Re: Ultrasonic Theremin Problems
also the SONIC part of that example seems to be old stuff.
but i try this:
in SONIC Pi (3.0.1)
test soundsystem with a
play 70 [Run]
now use this:
[Run]
open a IDLE3 new file window
and [run Module (F5)] ( save the python code )
you should hear every second a different piano note ( for test ) and see the printline of python
try:
synth :supersaw, to get a theremin like sound (instead of PIANO )
but i try this:
in SONIC Pi (3.0.1)
test soundsystem with a
play 70 [Run]
now use this:
Code: Select all
live_loop :RPI_theremin do
use_real_time
a, b, c = sync "/osc/play_this"
synth :piano, note: a, cutoff: b, sustain: c
end
open a IDLE3 new file window
Code: Select all
# from https://projects.raspberrypi.org/en/projects/ultrasonic-theremin/
# but (looks like) gpiozero AND SONIC code not work!
# on SONIC use: and press RUN
"""
# Welcome to Sonic Pi v3.0.1
live_loop :RPI_theremin do
use_real_time
a, b, c = sync "/osc/play_this"
synth :piano, note: a, cutoff: b, sustain: c
end
"""
# on PYTHON3 use
from gpiozero import DistanceSensor
from time import sleep
from random import random
from pythonosc import osc_message_builder
from pythonosc import udp_client
# for one ultrasonic sensor use
#sensor = DistanceSensor(echo=17, trigger=4)
sender = udp_client.SimpleUDPClient('127.0.0.1', 4559)
while True:
sensor = random() # for test without ultrasonic only
note = round(sensor * 80 + 20)
cutoff = 55
sustain = 0.5
print(note,cutoff,sustain)
sender.send_message('/play_this', [note, cutoff, sustain])
sleep(1.0)
you should hear every second a different piano note ( for test ) and see the printline of python
try:
synth :supersaw, to get a theremin like sound (instead of PIANO )
Re: Ultrasonic Theremin Problems
use a pygame window and mouse click / drag in it
instead of a ultrasonic sensor...
see a black window and press ( and hold and drag ) mouse in it.
code: here
now a test using VNC android tablet touchscreen on that window was not funny because of the strange VNC mouse options ( screen scrolling)
instead of a ultrasonic sensor...
see a black window and press ( and hold and drag ) mouse in it.
code: here
now a test using VNC android tablet touchscreen on that window was not funny because of the strange VNC mouse options ( screen scrolling)