Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

1V audio burst every OTHER pushbutton

Status
Not open for further replies.
Forgive me for a minor off-topic detour...

A guy walks into a bar. He puts a large bag on the bar as the bartender ambles over. The guy reaches into the bag and pulls out a little, 1 foot tall guy dressed in tails. He then pulls out a miniature "baby" grand. This is followed by a tiny bench.

The little guy sits and starts to play Bach concertos. The bartender, utterly amazed, blurts, "Whoa! How in the world...?". The guy holds up his hand and then pulls out a wee genie: "He'll grant you one wish!".

The bartender says, "That's easy! I want a million bucks!".

The bar immediately fills up with ducks. Mergansers, Eiders and Teals. Above the duck din, the bartender quickly responds by screaming, "Whoa! I didn't want ducks! I said a million BUCKS!!".

The guy says, "Well, the genie's a bit deaf. You don't really think I'd ask for a 12 inch pianist, do you!?".

On-topic.

also, this is for live sound, so unfortunately i won't have the luxury of the studio environment to go back and fix problems... gotta have a real-time solution, and something which is super easy to set up and calibrate because the occasion is ten grand pianos and i get very little sound check time!
Post #21.

All things considered, there are some very troublesome mechanical variables to this problem that simply do not seem surmountable.

First and foremost is the sustain pedal movement sensor's (of whatever flavor) appropriate position calibration. Every piano will be different. Every pianist's use (rest pressure, full/partial press, release, etc.) of the pedal will be different. Some even "ride" the pedal to slightly mute the lower register strings. All this will require an almost infinite range of settings to adapt the system (especially given your time constraints) to any peculiar piano/player.

This is why I lean heavily towards a audio signature (however difficult to characterize) identification algorithm that can then drive a muting solution. And this would, of course, require a pretty high level of uC programming/implementation sophistication.
 
I don't know what I don't know here, so it is hard for me to give details unless I'm answering a specific question...
I indexed the link where I asked questions, so I'll repeat it here.
Is there any room for a silent Beryllium Copper spring contact switch?
How do you intended to mount it , or what room is there for mounting?
Below the pedal only? or inside the piano?
Is there any possibility that a soft release is to be ignored, for soft music so you doesn't modulate the amplitude incorrectly?
 
Thanks for everyone's patience, this is all very new and confusing for me... lots of quick google searches to track with what everyone is saying!

Les, I had my friend take a quick look at what we've been talking about here and he said that it's nothing he can't handle. He apparently either has or can easily get the programming software for the chips. In fact, he thought that this all might be possible to do with Arduino Uno boards? The 5ms issue was only over the typo. I built a mechanical prototype of this device, with the simple ability to give me a click at the mixer input every time the pedal is released. With some added work in Apple Logic X, I got it to do pretty much what I want it to. But in the process I realized it would be very convenient to have the delay and velocity features built in to the unit. As cowboybob points out, every piano is slightly different and so I'll need options on the fly. The 10kHz wave's harmonic should probably be confined under 20kHz, and it is probably fine to lower the fundamental to maybe 5kHz if necessary so that the slope on the low-pass doesn't need to be so steep - the 100Hz low pass filter on the mixer will reduce anything above about 2kHz to nearly nothing. I can use two channels on the audio mixer, and avoid the problem of the summing, since I don't know how to find the impedance of the piano pickup I'll be using, unless there's a way to test for it on my own. Otherwise I'd have to track down the inventor of the pickup personally because I don't see any specifications for it on the website and nothing came with the product either... it is a bit obscure in the industry, and I believe he makes each one by hand.

As far as programming for some kind of audio signature, I'm sure it is possible, but it would take some incredible software at super low-latency. Think about having Melodyne in real-time! I can imagine a simpler way it could be done by sampling several thumps at various intensity levels from each piano and storing them as MIDI samples to be recalled by a MIDI trigger placed on the pedal, then reversed polarity and time-aligned in order to cancel out the thump sound (time alignment would be difficult because it may change greatly depending on the speed of the pedal release, unless the sensing unit or software can predict the moment of the thump based on pedal velocity - but of course would then also need to account for sudden changes of mind, or a half-depression, or whatever else.) But even this has problems because the nature of the thumps varies slightly depending on the preceding sonic content of the strings, and of course all reverse polarity tricks need to be almost precisely matched at the waveform level - any imperfections will be loud and clear. It is certainly an interesting line of thought!

What do live sound engineers use for birth control? Their personalities.

Tony, I'm not sure what your thoughts behind the silent Beryllium Copper spring contact switch are, can you explain how this might be used? Underneath the piano, there is a pipe which the pedal moved up and down, which pushes on a wooden lever attached to the dampers. There is a wooden block which holds the pedal pipes in places, and my plan was to attach the project box to this block somehow, using a clamp or whatever, and position it just behind the pedal pipe, and then attach whatever sensors, or sensor blocking device, to the pipe using a clamp of some kind and position everything accordingly. Whether the sensor is a brass pipe and wooden dowel mechanism, or some kind of hall-effect sensor with magnets, I'm sure I can figure out a flexible mounting solution, so I'm not terribly worried about it... the concept seems to be the more important element now? If you read back through the many posts, the issue of the soft/slow release and other problems such as the half-depression and changes of mind are in the works already.
 
My techie-friend who'd be helping me assemble things thinks that a programable board (such as Arduino) might be the easiest and most cost effective solution, then just hooking up the pots, power supply and sensors necessary and stuffing it all in a project box. What do you all think about this? Or are the chips you've been talking about cheaper and easier than buying used Arduino Uno boards?
 
I don't understand the logic of your sentence.
The 10kHz wave's harmonic should probably be confined under 20kHz, and it is probably fine to lower the fundamental to maybe 5kHz if necessary so that the slope on the low-pass doesn't need to be so steep - the 100Hz low pass filter on the mixer will reduce anything above about 2kHz to nearly nothing.
You cannot change the the harmonics of a square wave, They are just a mathematical fact. Lowering the tone frequency would make the harmonics more of a problem as the lowest frequency harmonic (15 Khz) would then be just in the audible range. There is no reason why the Aduino uno should not be used. It is a much more expensive solution (£18.00 +VAT, ATtiny13 is £0.50 +VAT, ATtiny2323 £1.06 +VAT These are Farnell prices. As you do not give your country in your profile the price comparisons may be different.) The arduino will also take more current. About 45 mA (The ATtiny13 takes 2 mA at 5 volts or about 1 mA at 3.5 volts.) The "easier" is difficult to define. The programming hardware for the arduino is minimal. (A usb cable.) I would find the arduino much harder to use as I am very poor at programming in "C" but reasonable in assembler.
I think you need to build a tone burst generator and do some testing to see if the principle works. I think dougy83's design with a magnet and reed switch would be the simplest to build for testing. We could spend forever discussing all the different possible solutions without actually doing anything.

Les.
 
You do not want a 10khz square wave because its second harmonic is at 20kHz, its third harmonic is at 30kHz and its fourth harmonic is at 40kHz etc. The 3rd and 4th harmonics will be at fairly high levels and will cause audible beat tones when they combine with the mixer's digital sampling frequency of 41kHz. If the 10kHz is a sine wave then it will not have any harmonics.

But actually a pure square wave has no even-numbered harmonics. Then the 30kHz 3rd harmonic will beat with the 41kHz sampling and produce 11kHz that the lowpass filter will not reduce.
 
I meant that the low-pass filter would reduce the square wave's harmonics so much so that the highest audible harmonic would be under 20kHz. It would have to be a steep filter, right? Or the fundamental tone would have to be lowered, and the low pass would have to be lowered as well, so that the slope of the filter would be able to reach very great attenuation levels by 20kHz. Does this make sense?
 
I sorta live in multiple countries, but dollars is fine. I guess used arduino boards are around $4? Anyway, would you be able to send me some code that I could throw into assembler?
 
I meant that the low-pass filter would reduce the square wave's harmonics so much so that the highest audible harmonic would be under 20kHz. It would have to be a steep filter, right? Or the fundamental tone would have to be lowered, and the low pass would have to be lowered as well, so that the slope of the filter would be able to reach very great attenuation levels by 20kHz. Does this make sense?
You are blasting the 10kHz at a very high level. The lowpass filter might not be steep enough to eliminate audible harmonics. The lowpass filter in the digital mixer also might be digital and cause trouble with harmonics and the sampling frequency beating together.
 
Well if I just decide to go ahead and use an extra channel on the mixer, then it doesn't matter too much. I'll just make the thing, try it out on the same channel using my own summing amp separately, and if it doesn't work then I'll just use two channels.

I'm guessing at this point I need to make a test circuit, and I don't mind buying the chips and programming it all in. Can someone give me a parts list, diagram, and the code for it?
 
This is the assembler source code for the tone burst generator using an ATtiny13 (You will probably have to buy an ATtiny13a as this has replaced the ATtiny13. It is functionally the same.
The fuse setting are
Low fuse = 0x62
High fuse = 0xFF (I think these are the default settings on a new chip.)

/*
* 10 Khz Toneburst test
*
* Created: 01/08/2015 17:18
* Modified 09/08/15 to change burst length from 50 mS to 5 mS
* Author: Les
*/
; using ATTINY13

; 10 Khz Low for 50 uS High for 50 uS
;

;Use internal clock at 9.6 Mhz (Default value) and divide by 8 by setting CKDIV8 fuse bit (These are the default setting on a new chip.)
; 9.6 Mhz/8 = 1.2 Mhz
;(So Instruction time = 833.3 nS)

; So for 50 uS delay requires 50/0.8333 = 60 instructions

; Burst needs to be 50 mS long. This will be 500 cycles of 10 Khz

;
;**************************************************************************
.nolist
.include <tn13def.inc> ; ATtiny 13
.list
.listmac

;***************************************************************************
;*
;* Global Register Variables
;*
;***************************************************************************
; Note register number is in decimal

.def count_L = r18 ; Counter low byte
.def cycles_L = r19 ; Counter for number of cycles of 10 Khz to last 50 mS
.def cycles_H = r20

;
;******************************** INTERRUPT VECTORS ***********************
.CSEG
.ORG $00
rjmp reset
reti
reti
reti
reti
reti ; rjmp timer1_OVF
reti
reti
reti
reti
;



;******************************* RESET *************************************
;
; Initialise the stack-pointer
reset:
ldi R16,low(RAMEND)
out SPL,R16



; initialize PORTB
; Bit 0 Input Pedal switch input (pin
; Bit 1 Input
; Bit 2 Input
; Bit 3 Output (Pin 2)
; Bit 4 Output (Pin 3)
; Bit 5 Input

ldi R16,0x18 ; Bits 3 and 4 as outputs.
out DDRB,R16 ;
ldi R16,0x08
out PORTB,R16 ; PORTB Bit 3 high, bit 4 low

;Initialize Timer 0



;
; Main program code
;
Main:

Test_pedal_act: ; Contacts between ground and input will be closed in ststic position of pedal. (Input will be low.)
;
sbis PINB,0 ;
rjmp Test_pedal_act ;Loop until pedal is pressed

pedal_down_loop:
sbic PINB,0 ;
rjmp pedal_down_loop ; loop until pedal released


Burst:
; ldi cycles_L,0xFA ;250 decimal (As the tone loop produces 2 cycles of 10 Khz then we only need to count to 250 (This line was for 50 mS burst.)
ldi cycles_L,0x19 ;25 decimal (As the tone loop produces 2 cycles of 10 Khz then we only need to count to 25 (This line was for 5 mS burst.)


Tone_loop:
ldi R16,0x08
out PORTB,R16 ; PORTB Bit 3 high, bit 4 low
rcall Delay_50_uS
ldi R16,0x10
out PORTB,R16 ; PORTB Bit 3 low, bit 4 high
rcall Delay_50_uS

ldi R16,0x08
out PORTB,R16 ; PORTB Bit 3 high, bit 4 low
rcall Delay_50_uS
ldi R16,0x10
out PORTB,R16 ; PORTB Bit 3 low, bit 4 high
rcall Delay_50_uS

dec cycles_L
tst cycles_L
brne Tone_loop


rjmp Test_pedal_act
;


; --------------------------------------------------
;
;Subroutines.
;
;
; ----------------------------------------------
Delay_50_uS:
ldi count_L,0x0E ;Decimal 14 (Once round the loop is 4 instructions)
D_50_Loop:
dec count_L ; Count_L is R19
tst count_L
brne D_50_Loop ;If not zero
ret


; -------------End of subroutines --------------
;
This code is for the schematic in post #66
It does not have the 0 - 500 mS delay. I will add this code when I get time for the delay when I get time. The only change to the schematic will be an additional 10K potentiometer. One end of the track will be connected to 0 volts and the other end to +5 volts. The slider will be connected to pin 7 of the Attiny13, When I modify the code I will also add some code to deal with contact bounce that may occur if a mechanical switch is used as a trigger. I have uploaded the .HEX file so you can just program it into the ATtiny13 without having to assemble the source code.

Les.
 

Attachments

  • ToneBurst02a.hex
    276 bytes · Views: 155
Les, this is wonderful! So much more than I ever expected. Now I have what is probably a dumb question, but is there a drawing of some kind that tells me how or where to actually solder what to what on the chip? I might have to build my own prototype, as my tech friend isn't available to dig into this project with me for a few more months... and I'm fine just going ahead and getting the photo interrupters from the start, instead of a reed switch (unless you think the reed switch is better?)

Also, how do I physically get in and out of the ATtiny13 with my Macbook Pro in order to program it? Is there a special cable or something? Seems like a lot of people on YouTube are using an Arduino board in order to program the ATtiny13 chip? Is there a way to go right into the chip from my USB port, and is there a version of Assembly for Mac?
 
Last edited:
You will either need to learn to read schematics or wait until your friend is available to help you. A reed switch and magnet (Alarm contacts) may be easier to fit but the operating position may not be as precise as an optical sensor. If you look for alarm contacts on ebay you will find many different types of construction. You may find a type that is easy to fit to the pedal linkage.
I know nothing about Apple computers so you would have to search the web to see if they can be used to program Atmel AVR chips (The ATtiny13 is one of this family) If you were using a windows or linux computer the cheapest programming hardware is the USBasp programmer You can get them on ebay for example this one.
**broken link removed**
If you get one of these make sure it has three jumper links (Or holes to fit them.) as you will need to insert jumper number 3 to set the programming clock to a slow speed which is needed to program the ATtiny13 chip. An arduino can be loaded with code to emulate a USBasp programmer.

Les.
 
Here are the files with the firmware and schematics for the tone burst generator. The schematic 03 just has a low pass filter on the output. 3a has a tuned circuit that gives a reasonable sine wave output. Make sure that the potentiometer that you use has very low resistance at the end of it's travel. If it does not you will not be able to set the delay to zero or low settings. The delay will increment in steps of 2 mS as I only used 8 bits of the 10 bit output from the ADC converter. (There would be no point in trying to use all 10 bits unless a very good quality potentiometer was used.) The minimum delay is zero the maximum delay is 510 mS

Les.
 

Attachments

  • Toneburst03.asm
    4.5 KB · Views: 146
  • Toneburst03.hex
    407 bytes · Views: 166
  • ToneBurst03.pdf
    27.3 KB · Views: 203
  • ToneBurst03a.pdf
    27.6 KB · Views: 189
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top