Noteplayer not working

I used the following code to make some sound. but i only get error messages
NotePlayer1.Instrument=20
NotePlayer1.PlayNote(60,60)
NotePlayer1.PlayNote(60,0)

Am I doing somehting or is noteplayer not supported anymore?

What platform are you running? And what error messages?

I’m using Windows 8 on 214R41

The error messages are “this item does not exist” The code comes directly from the LR

[quote=65467:@Frank Hendriksen]I’m using Windows 8 on 214R41

The error messages are “this item does not exist” The code comes directly from the LR[/quote]

The example code assumes you’ve dragged a NotePlayer object from the library onto your window.

I added the noteplayer object, but still no sound. btw the error messages gone

The first PlayNote starts the note with a velocity of 60, but the second one stops the note by specifying a velocity of 0. Does removing the second PlayNote fix things? The example in the language reference sounds pretty bad and you should file a bug report about it.

Did you program some kind of delay between the first note with velocity 60 and the second one with volume 0? If not, it would be no surprise if you couldn’t hear anything. The note is stopped once it starts playing.

… and did you check for extended classes on note player here or elsewhere? I guess it would be nice to have a method playnote with pitch, velocity and length as well so you could feed it with complete note informations. I guess a timer would be a good solution that sets its one-time interval calculating the note length by bpm and when being triggered sends out a “same pitch, velocity 0” call to note player.

Also check out the DoReMi example here: Examples/Graphics and Multimedia/DoReMi.

I’ve updated NotePlayer in the language reference with this example.