Main Site Documentation

Tunes Namespace or Bad Module?


#1

Going through the starter projects in the tinkerguide so far so good except I’m not getting any sounds using a basic tester to see if the hardware is bad, so far no luck.

Hardware states Tunes 1.0 and is part of the FEZ Spider Kit.

Using NETMF 4.3.

Loader (TinyBooter) version information:
4.3.4.0 on this computer.
4.3.4.0 on this device.

The Loader (TinyBooter) is up to date. <<<

Firmware (TinyCLR) version information:
4.3.6.0 on this computer.
4.3.6.0 on this device.

The Firmware (TinyCLR) is up to date. <<<
Please wait for the device to reboot… Done.

public partial class Program
  {
    // This method is run when the mainboard is powered up or reset.   
    void ProgramStarted()
    {
      Debug.Print("Program Started");

      Tunes.MusicNote note = new Tunes.MusicNote(Tunes.Tone.C4, 400);

      tunes.AddNote(note);

      // up
      PlayNote(Tunes.Tone.C4);
      PlayNote(Tunes.Tone.D4);
      PlayNote(Tunes.Tone.E4);
      PlayNote(Tunes.Tone.F4);
      PlayNote(Tunes.Tone.G4);
      PlayNote(Tunes.Tone.A4);
      PlayNote(Tunes.Tone.B4);
      PlayNote(Tunes.Tone.C5);

      // back down
      PlayNote(Tunes.Tone.B4);
      PlayNote(Tunes.Tone.A4);
      PlayNote(Tunes.Tone.G4);
      PlayNote(Tunes.Tone.F4);
      PlayNote(Tunes.Tone.E4);
      PlayNote(Tunes.Tone.D4);
      PlayNote(Tunes.Tone.C4);

      // arpeggio
      PlayNote(Tunes.Tone.E4);
      PlayNote(Tunes.Tone.G4);
      PlayNote(Tunes.Tone.C5);
      PlayNote(Tunes.Tone.G4);
      PlayNote(Tunes.Tone.E4);
      PlayNote(Tunes.Tone.C4);

      tunes.Play();

      Thread.Sleep(100);

      PlayNote(Tunes.Tone.E4);
      PlayNote(Tunes.Tone.G4);
      PlayNote(Tunes.Tone.C5);
      PlayNote(Tunes.Tone.G4);
      PlayNote(Tunes.Tone.E4);
      PlayNote(Tunes.Tone.C4);

      tunes.Play();

      
    }

    void PlayNote(Tunes.Tone tone)
    {
      Tunes.MusicNote note = new Tunes.MusicNote(tone, 200);

      tunes.AddNote(note);
    }
  }

#2

This post should be in Gadgeteer Forum, only noticied I posted in wrong forum much later.


#3

@ josequinonesii - You want something like the below. The AddNote function adds a note to an existing playlist while Play() is actually Play(params MusicNote[] notes), so you were telling it to play nothing.


using Gadgeteer.Modules.GHIElectronics;
using Microsoft.SPOT;
using System.Threading;

namespace GadgeteerApp1
{
	public partial class Program
	{
		void ProgramStarted()
		{
			var melody = new Tunes.Melody();

			// up
			melody.Add(Tunes.Tone.C4, 200);
			melody.Add(Tunes.Tone.D4, 200);
			melody.Add(Tunes.Tone.E4, 200);
			melody.Add(Tunes.Tone.F4, 200);
			melody.Add(Tunes.Tone.G4, 200);
			melody.Add(Tunes.Tone.A4, 200);
			melody.Add(Tunes.Tone.B4, 200);
			melody.Add(Tunes.Tone.C5, 200);

			// back down
			melody.Add(Tunes.Tone.B4, 200);
			melody.Add(Tunes.Tone.A4, 200);
			melody.Add(Tunes.Tone.G4, 200);
			melody.Add(Tunes.Tone.F4, 200);
			melody.Add(Tunes.Tone.E4, 200);
			melody.Add(Tunes.Tone.D4, 200);
			melody.Add(Tunes.Tone.C4, 200);

			// arpeggio
			melody.Add(Tunes.Tone.E4, 200);
			melody.Add(Tunes.Tone.G4, 200);
			melody.Add(Tunes.Tone.C5, 200);
			melody.Add(Tunes.Tone.G4, 200);
			melody.Add(Tunes.Tone.E4, 200);
			melody.Add(Tunes.Tone.C4, 200);

			tunes.Play(melody);
		}
	}
}


#4

I neglected to say that the Tunes sound did not work in the tinkerguide example as well.

However, I’ll still try you example when I get home tonight.


#5

Ok the module works… sigh, feel like a dope thanks for the help :slight_smile:


#6

@ josequinonesii -

Just a follow-up:

With John’s example above? With Tinker Kit example, or both?