Merging Adafruit Audio & v1DCMotor Shields with a nano and push buttons

I am not had any code writing experience before, this is my first ever and have this little project I wish to complete and need help, PLEASE:
I want this to drive a dc motor and sync it with change of motor speed with the sound on a wav file. It is in two parts; case 1 and case 2, relating to switch position 1 and switch position 2. Case 1 has within in tow parts, the first plays a wav file whilst 3 motor speed changes take place, and then they all stop and in the 2nd part another wav file takes over and a set speed and they play in a loop until the switch is switch to position 2 when another wav file is played to its end and the motor stops.

I now have, with all the devices connected together, both the audio and DC Motors working off the same test push button sketch configuration. Both working perfectly, sequence, timing and switch control. They are below:

DC Motor

#include "WaveUtil.h"
#include "WaveHC.h"
#include <AFMotor.h>

WaveHC wave;

#define DEBOUNCE 100  // button debouncer


// DC motor on M2
AF_DCMotor motor(1);

/////////////////////////////////////////////
void setup()
{

  Serial.begin(9600);
  putstring_nl("WaveHC with 6 buttons");


  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);

  pinMode(13, OUTPUT);

  digitalWrite(14, HIGH);
  digitalWrite(15, HIGH);
  digitalWrite(16, HIGH);
  digitalWrite(17, HIGH);
  digitalWrite(18, HIGH);
  digitalWrite(19, HIGH);

  {
    Serial.begin(9600);           // set up Serial library at 9600 bps
    Serial.println("Typhoon Engine");

    // turn on motor #1
    motor.setSpeed(113);  // max speed of motor
    motor.run(RELEASE);
  }

  int i;
}

////////////////////////////Button Interface///////////
void loop() {
  //putstring(".");            // uncomment this to see if the loop isnt running

  switch (check_switches())
  {
    case 1:

      Serial.print("fwd to 113");
      motor.run(FORWARD);
      motor.setSpeed(113);
      delay(2000);

      Serial.print("fwd at 57");
      motor.setSpeed(57);
      delay(8000);

      Serial.print("fwd at 85");
      motor.setSpeed(85); // - 28 from 113 to get to 85
      delay(8000);

      while (check_switches() != 2)
      {
      Serial.print("fwd in loop");
      motor.setSpeed(70);
      delay(16000) ;
      }
      while (check_switches() != 2)
        break;

    case 2:
      Serial.print("fwd Shutdown");
      motor.run(FORWARD);
      motor.setSpeed(57);
      delay(2000);
      
      Serial.print("Shutdown");
      motor.run(RELEASE);
      motor.setSpeed(0);
//      delay(20000);
      while (check_switches() != 2)
        break;
  }
}
byte check_switches()
{
  static byte previous[6];
  static long time[6];
  byte reading;
  byte pressed;
  byte index;
  pressed = 0;

  for (byte index = 0; index < 6; ++index)
  {
    reading = digitalRead(14 + index);
    if (reading == LOW && previous[index] == HIGH && millis() - time[index] > DEBOUNCE)
    {
      // switch pressed
      time[index] = millis();
      pressed = index + 1;
      break;
    }
    previous[index] = reading;
  }
  // return switch number (1 - 6)
  Serial.println(pressed);
  return (pressed);
}

Part 2
Audio

#include <FatReader.h>
#include <SdReader.h>
#include <avr/pgmspace.h>
#include "WaveUtil.h"
#include "WaveHC.h"
#include <Wire.h>


SdReader card;    // This object holds the information for the card
FatVolume vol;    // This holds the information for the partition on the card
FatReader root;   // This holds the information for the filesystem on the card
FatReader f;      // This holds the information for the file we're play

WaveHC wave;      // This is the only wave (audio) object, since we will only play one at a time

#define DEBOUNCE 100  // button debouncer

// this handy function will return the number of bytes currently free in RAM, great for debugging!
int freeRam(void)
{
  extern int  __bss_end;
  extern int  *__brkval;
  int free_memory;
  if ((int)__brkval == 0)
  {
    free_memory = ((int)&free_memory) - ((int)&__bss_end);
  }
  else
  {
    free_memory = ((int)&free_memory) - ((int)__brkval);
  }
  return free_memory;
}

void sdErrorCheck(void)
{
  if (!card.errorCode()) return;
  putstring("\n\rSD I/O error: ");
  Serial.print(card.errorCode(), HEX);
  putstring(", ");
  Serial.println(card.errorData(), HEX);
  while (1);
}

/////////////////////////////////////////////
void setup()
{
  // set up serial port
  Serial.begin(9600);
  putstring_nl("WaveHC with 6 buttons");

  putstring("Free RAM: ");   // This can help with debugging, running out of RAM is bad
  Serial.println(freeRam());      // if this is under 150 bytes it may spell trouble!

  // Set the output pins for the DAC control. This pins are defined in the library
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);

  // pin13 LED
  pinMode(13, OUTPUT);

  // enable pull-up resistors on switch pins (analog inputs)
  digitalWrite(14, HIGH);
  digitalWrite(15, HIGH);
  digitalWrite(16, HIGH);
  digitalWrite(17, HIGH);
  digitalWrite(18, HIGH);
  digitalWrite(19, HIGH);

  //  if (!card.init(true))
  //{ //play with 4 MHz spi if 8MHz isn't working for you
  if (!card.init())
  { //play with 8 MHz spi (default faster!)
    putstring_nl("Card init. failed!");  // Something went wrong, lets print out why
    sdErrorCheck();
    while (1);                           // then 'halt' - do nothing!
  }

  // enable optimize read - some cards may timeout. Disable if you're having problems
  card.partialBlockRead(true);

  // Now we will look for a FAT partition!
  uint8_t part;
  for (part = 0; part < 5; part++)
  { // we have up to 5 slots to look in
    if (vol.init(card, part))
      break;                             // we found one, lets bail
  }
  if (part == 5)
  { // if we ended up not finding one
    putstring_nl("No valid FAT partition!");
    sdErrorCheck();      // Something went wrong, lets print out why
    while (1);                           // then 'halt' - do nothing!
  }

  // Lets tell the user about what we found
  putstring("Using partition ");
  Serial.print(part, DEC);
  putstring(", type is FAT");
  Serial.println(vol.fatType(), DEC);    // FAT16 or FAT32?

  // Try to open the root directory
  if (!root.openRoot(vol))
  {
    putstring_nl("Can't open root dir!"); // Something went wrong,
    while (1);                            // then 'halt' - do nothing!
  }

  // Whew! We got past the tough parts.
  putstring_nl("Ready!");
  //dirLevel = 0;
}

////////////////////////////Button Interface///////////
void loop() {
  //putstring(".");            // uncomment this to see if the loop isnt running
  switch (check_switches())
  {
    case 1:
      playcomplete("1.WAV");
      wave.stop();

      while (check_switches() != 2)
      {
        playfile("2.WAV");
        delay(20000) ;  // wait 20 sec before playing
        //while (wave.isplaying && check_switches() != 2)
        wave.stop();
      }
      while (check_switches() != 2)
        break;

    case 2:
      playcomplete("3.WAV");
      wave.stop();
      while (check_switches() == 2);        // this to detect when to stop ( == means equal to "case 2")
      break;

    case 3:  //not used
      playcomplete("3.WAV");
      break;
      wave.stop();

    case 4:  //not used
      playfile("Hawker_Typhoon_1Bmono.WAV");
      while (wave.isplaying && check_switches() == 4)

        wave.stop();

    case 5:  //not used
      playfile("tempest.WAV");
      while (wave.isplaying && check_switches() == 5)
      wave.stop();

    case 6:  //not used
      playfile("LA.WAV");
      while (wave.isplaying && check_switches() == 6)
       wave.stop();
  }
}

byte check_switches()
{
  static byte previous[6];
  static long time[6];
  byte reading;
  byte pressed;
  byte index;
  pressed = 0;

  for (byte index = 0; index < 6; ++index)
  {
    reading = digitalRead(14 + index);
    if (reading == LOW && previous[index] == HIGH && millis() - time[index] > DEBOUNCE)
    {
      // switch pressed
      time[index] = millis();
      pressed = index + 1;
      break;
    }
    previous[index] = reading;
  }
  // return switch number (1 - 6)
  Serial.println(pressed);  // print out the switch press that was detected
  return (pressed);
}
////////////////////Play File//////////////////
// Plays a full file from beginning to end with no pause.
void playcomplete(char *name)
{
  // call our helper to find and play this name
  playfile(name);
  while (wave.isplaying)
  {
    // do nothing while its playing
  }
  // now its done playing
}

void playfile(char *name)
{
  // see if the wave object is currently doing something
  if (wave.isplaying)
  { // already playing something, so stop it!
    wave.stop(); // stop it
  }
  // look in the root directory and open the file
  if (!f.open(root, name))
  {
    putstring("Couldn't open file ");
    Serial.print(name);
    return;
  }
  // OK read the file and turn it into a wave object
  if (!wave.create(f))
  {
    putstring_nl("Not a valid WAV");
    return;
  }

  // ok time to play! start playback
  wave.play();
}

Part 3
Identical... and here they are merged.

#include <FatReader.h>
#include <SdReader.h>
#include <avr/pgmspace.h>
#include "WaveUtil.h"
#include "WaveHC.h"
#include <AFMotor.h>


SdReader card;
FatVolume vol;
FatReader root;
FatReader f;

WaveHC wave;

#define DEBOUNCE 100  // button debouncer

int freeRam(void)
{
  extern int  __bss_end;
  extern int  *__brkval;
  int free_memory;
  if ((int)__brkval == 0)
  {
    free_memory = ((int)&free_memory) - ((int)&__bss_end);
  }
  else
  {
    free_memory = ((int)&free_memory) - ((int)__brkval);
  }
  return free_memory;
}

void sdErrorCheck(void)
{
  if (!card.errorCode()) return;
  putstring("\n\rSD I/O error: ");
  Serial.print(card.errorCode(), HEX);
  putstring(", ");
  Serial.println(card.errorData(), HEX);
  while (1);
}

AF_DCMotor motor(1);

/////////////////////////////////////////////
void setup()
{

  Serial.begin(9600);
  putstring_nl("WaveHC with 6 buttons");

  putstring("Free RAM: ");
  Serial.println(freeRam());

  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);

  pinMode(13, OUTPUT);

  digitalWrite(14, HIGH);
  digitalWrite(15, HIGH);
  digitalWrite(16, HIGH);
  digitalWrite(17, HIGH);
  digitalWrite(18, HIGH);
  digitalWrite(19, HIGH);
  {
    Serial.begin(9600);           // set up Serial library at 9600 bps
    Serial.println("Typhoon Time!");

    // turn on motor #1
    motor.setSpeed(113);
    motor.run(RELEASE);
  }

  if (!card.init())
  { //play with 8 MHz spi (default faster!)
    putstring_nl("Card init. failed!");
    sdErrorCheck();
    while (1);
  }

  card.partialBlockRead(true);

  uint8_t part;
  for (part = 0; part < 5; part++)
  {
    if (vol.init(card, part))
      break;
  }
  if (part == 5)
  {
    putstring_nl("No valid FAT partition!");
    sdErrorCheck();
    while (1);
  }


  putstring("Using partition ");
  Serial.print(part, DEC);
  putstring(", type is FAT");
  Serial.println(vol.fatType(), DEC);

  if (!root.openRoot(vol))
  {
    putstring_nl("Can't open root dir!");
    while (1);
  }
  putstring_nl("Ready!");

  int i;
}

////////////////////////////Button Interface///////////
void loop() {
  //putstring(".");            // uncomment this to see if the loop isnt running

  switch (check_switches())

  {
    case 1:
      playfile("1.WAV");

      Serial.print("fwd to 113");
      motor.run(FORWARD);
      motor.setSpeed(113);
      delay(2000);

      Serial.print("fwd at 57");
      motor.setSpeed(57);
      delay(8000);

      Serial.print("fwd at 85");
      motor.setSpeed(85); // - 28 from 113 to get to 85
      delay(8000);

      while (check_switches() != 2)

      {
        playfile("2.WAV");
        Serial.print("fwd in loop");
        motor.setSpeed(70);
        delay(16000) ;
      }
      while (check_switches() != 2)
        break;

    case 2:
      playcomplete("3.WAV");

      Serial.print("fwd Shutdown");
      motor.run(FORWARD);
      motor.setSpeed(57);
      delay(2000);

      Serial.print("Shutdown");
      motor.run(RELEASE);
      motor.setSpeed(0);
      //      delay(20000);
      while (check_switches() == 2);
      break;
  }
}

byte check_switches()
{
  static byte previous[6];
  static long time[6];
  byte reading;
  byte pressed;
  byte index;
  pressed = 0;

  for (byte index = 0; index < 6; ++index)
  {
    reading = digitalRead(14 + index);
    if (reading == LOW && previous[index] == HIGH && millis() - time[index] > DEBOUNCE)
    {
      // switch pressed
      time[index] = millis();
      pressed = index + 1;
      break;
    }
    previous[index] = reading;
  }
  // return switch number (1 - 6)
  Serial.println(pressed);
  return (pressed);
}
////////////////////Play File//////////////////
void playcomplete(char *name)
{

  playfile(name);
  while (wave.isplaying)
  {
    // do nothing while its playing
  }
  // now its done playing
}

void playfile(char *name)
{
  if (wave.isplaying)
  {
    wave.stop(); // stop it
  }
  if (!f.open(root, name))
  {
    putstring("Couldn't open file ");
    Serial.print(name);
    return;
  }
  if (!wave.create(f))
  {
    putstring_nl("Not a valid WAV");
    return;
  }
  wave.play();
}

So a clean merge and no memory warnings. Though close, the motors stopped working in the merged version, so the code is getting lost some how or somewhere. This could be an "incompatibility" in some way, but I want to see if there is a way round this.... If I have made a mistake somewhere, or missed something silly. As I said at the start, I have never written code before and whilst I take a look at tutorials, they confuse me far more than having someone point something out and explain why. Not found anything on this as yet.....

PLEASE help.

There is an incompatability, but there is also a work-around, but need a little confidence to give it a try. The problem being the PWM timers on the nano; used by both shields. Seems I was given bad advise at the start.

Decision time. Try the workround or wait for a v2????

https://forums.adafruit.com/viewtopic.php?f=31&t=8066&p=63795&hilit=audio+shield+with+v1+motor+shield#p63795

For when the v2 arrives: If I change the libraries and the way the motor is called, will the sketch I have made just work as is, or will it need more work on it, please?