def sinePictureSound():

  size = 320 #size of the empty picture

  pic = makeEmptyPicture(size,size) #empty picture
  snd = makeEmptySound(5) #empty sound

  maxColorValue = 255 #max RGB color value for the picture

  sr = getSamplingRate(snd) #sample rate of the sound
  samplesPerCycle = 1.0*size #sound samples per cycle

  freq = sr / samplesPerCycle #sound frequency
  print(freq)

  maxCycle = 2*pi #maximum sound cycles

  soundAmplitudeScale = 32768.0/maxColorValue #sound amplitude scale for scaling up values for a sound sample
  print(soundAmplitudeScale)

  pos = 0 #set starting positon for calculating sine, and the stating sample position in the sound
  for p in getPixels(pic): #loop for all pixels in pic
    rawSample = sin((pos / samplesPerCycle)*maxCycle) #calculate the raw sample value for the pixel color and sound sample
    sampleVal = int(maxColorValue*rawSample) #calculate the pixel color value
    #set the pixel color
    setRed(p, sampleVal)
    setGreen(p, sampleVal)
    setBlue(p, sampleVal)
    if int(sampleVal*soundAmplitudeScale) > 32639: #if the sine wave has reached the peak
      setSampleValueAt(snd,pos+1,32639) #set the sample value to the maximum to ensure that it does not exceed the maximum and create a sharp dip in the sound wave
    else: #otherwise set the sample to the sine curve value
      setSampleValueAt(snd,pos+1,int(sampleVal*soundAmplitudeScale))

    pos = pos + 1 #increment the sample position in the sound

  return (pic, snd)
